<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" href="${staticServer}/inc/style/main.css" />
<link rel="stylesheet" href="${staticServer}/inc/style/page.css" />
<link rel="stylesheet" href="${staticServer}/css/struct_info.css" />
<script src="${staticServer}/inc/js/jquery.js"></script>
<script src="${staticServer}/inc/js/pageset.js"></script>
<script src="${staticServer}/inc/js/submitter.js"></script>
<script src="${staticServer}/inc/js/infopad.js?2.2"></script>
<script type="text/javascript" src="${staticServer}/common/uploadify/jquery.uploadify.js"></script>
<script type="text/javascript" src="${staticServer}/js/web/uploadImg.js?1.5"></script>

<link rel="stylesheet" href="${staticServer}/inc/style/date/datepicker.css" />
<script src="${staticServer}/inc/js/datepicker.js"></script>

<style>
#SWFUpload_0{
	margin-top: 70px;
    margin-left: -30px;
}
#SWFUpload_1{
	margin-top: 70px;
    margin-left: -30px;
}
</style>
<script>
var contextPath='${contextPath}';
var _contextPath = '${staticServer}';

$(function(){
	$("#center").val("<#if daikuan??>${daikuan.center_id}</#if>");
	$("#dk_type").val("<#if daikuan??>${daikuan.dk_type}</#if>");
	
	var state = "<#if daikuan??>${daikuan.state}</#if>";
	if(state=="3"){
		$("#one").show();
	}else{
		$("#one").hide();
	}
	
	$("#state").change(function(){
		var state = $("#state").val();
		if(state=="3"){
			$("#one").show();
		}else{
			$("#one").hide();
		}
	});
});

var addDaikuan = function(){
	var id = $("#id").val();
	var center_id = $("#center").val();
	var address = $("#address").val();
	var date = $("#date").val();
	var xf_date = $("#xf_date").val();
	var year = $("#year").val();
	var month = $("#month").val();
	var moneys = $("#moneys").val();
	
	var company = $("#company").val();
	var daikuan = $("#daikuan").val();
	var dk_type = $("#dk_type").val();
	var phone = $("#phone").val();
	var m_msg = $("#m_msg").val();
	var dk_msg = $("#dk_msg").val();
	
	var img_url = $("#all_words").val();
	
	if(center==""){
		infopad.err("请选择中心名称!");
		return;
	}
	if(address==""){
		infopad.err("请填写中心地址!");
		return;
	}
	if(date==""){
		infopad.err("请选择办理时间!");
		return;
	}
	if(xf_date==""){
		infopad.err("请选择续费开始日期!");
		return;
	}
	if(dk_type==""){
		infopad.err("请选择带宽类型!");
		return;
	}
	if(phone==""){
		infopad.err("请填写联系方式!");
		return;
	}
	
	$.post("${contextPath}/index/add_daikuan.json", {
			"id":id,
			"center_id":center_id,
			"address":address,
			"date":date,
			"xf_date":xf_date,
			"year":year,
			"month":month,
			"moneys":moneys,
			"company":company,
			"daikuan":daikuan,
			"dk_type":dk_type,
			"phone":phone,
			"m_msg":m_msg,
			"dk_msg":dk_msg,
			"img_url":img_url
		}, function(ms) {
		    var msg = ms.msg;
		    if(msg!=null && msg=="1"){
				infopad.msg("操作成功！");
				window.location.href="${contextPath}/index/daikuanList.htm";
		    }else{
		    	infopad.err("操作失败，请联系管理员！");
		    }
			
	});
};

</script>
</head>
<input type="hidden" id="id" value="<#if daikuan??>${daikuan.id}</#if>">
<body>
	<div id="home_link">
		<ul>
			<li></li>
			<li>&gt;</li>
			<li>组织架构</li>
			<li>&gt;</li>
			<li class="current">title</li>
		</ul>
	</div>

	<div id="container">
		<div id="title">添加项目需求</div>
		<table id="infotable">
			
			<tr>
				<th>中心名称:</th>
				<td>
					<select id="center">
						<option value="">全部</option>
					<#if olist??>
						<#list olist as list>
							<option value="${list.id}">${list.name}</option>
						</#list>
					</#if>
					</select>
				</td>
			</tr>
			
			<tr>
				<th>中心地址:</th>
				<td>
					<input type="text" id="address" size="50" value="<#if daikuan??>${daikuan.address}</#if>">
				</td>
			</tr>
			
			<tr>
				<th>办理时间:</th>
				<td>
					<input type="text" id="date" value="<#if daikuan??>${daikuan.date}</#if>" value="" size="14" maxlength="15">
				</td>
			</tr>
			
			<tr>
				<th>续费开始日期:</th>
				<td>
					<input type="text" id="xf_date" value="<#if daikuan??>${daikuan.xf_date}</#if>" value="" size="14" maxlength="15">
				</td>
			</tr>
			
			<tr>
				<th>续费时长:</th>
				<td>
					<input type="text" id="year" onkeyup="this.value=this.value.replace(/[^0-9.]/g,'')" onafterpaste="this.value=this.value.replace(/[^0-9.]/g,'')" size="10" value="<#if daikuan??>${daikuan.year}</#if>">年
					<input type="text" id="month" onkeyup="this.value=this.value.replace(/[^0-9.]/g,'')" onafterpaste="this.value=this.value.replace(/[^0-9.]/g,'')" size="10" value="<#if daikuan??>${daikuan.month}</#if>">月
				</td>
			</tr>
			
			<tr>
				<th>费用:</th>
				<td>
					<input type="text" id="moneys" onkeyup="this.value=this.value.replace(/[^0-9.]/g,'')" onafterpaste="this.value=this.value.replace(/[^0-9.]/g,'')" size="10" value="<#if daikuan??>${daikuan.moneys}</#if>">
				</td>
			</tr>
			
			<tr>
				<th>供应商:</th>
				<td>
					<input type="text" id="company" size="50" value="<#if daikuan??>${daikuan.company}</#if>">
				</td>
			</tr>
			
			<tr>
				<th>宽带:</th>
				<td>
					<input type="text" id="daikuan" size="10" value="<#if daikuan??>${daikuan.daikuan}</#if>">M
				</td>
			</tr>
			
			<tr>
				<th>宽带类型:</th>
				<td>
				<select id="dk_type">
					<option value="">请选择类型</option>
					<option value="光纤">光纤</option>
					<option value="普通光纤">普通光纤</option>
					<option value="普通宽带">普通宽带</option>
					<option value="普通线路">普通线路</option>
					<option value="商业线路">商业线路</option>
					<option value="政企">政企</option>
					<option value="单宽带">单宽带</option>
					<option value="联通私活">联通私活 </option>
				</select>
				</td>
			</tr>
			
			<tr>
				<th>联系方式:</th>
				<td>
					<input type="text" id="phone" onkeyup="this.value=this.value.replace(/[^0-9.]/g,'')" onafterpaste="this.value=this.value.replace(/[^0-9.]/g,'')" size="50" value="<#if daikuan??>${daikuan.moneys}</#if>">
				</td>
			</tr>
			
			<tr>
				<th>资费说明:</th>
				<td>
					<textArea id="m_msg" style="width:500px;height:150px;"><#if daikuan??>${daikuan.m_msg}</#if></textArea>
				</td>
			</tr>
			
			<tr>
				<th>宽带信息:</th>
				<td>
					<textArea id="dk_msg" style="width:500px;height:150px;"><#if daikuan??>${daikuan.dk_msg}</#if></textArea>
				</td>
			</tr>
			
			<tr>
				<th>相关图片:</th>
				<td>
					<ul class="imglist">
					<div id="images" style="float: left;">
						<#if daikuan?? && daikuan.img_url?? && daikuan.img_url!="">
							<#list daikuan.img_url?split(",") as imgurl>
								<#if imgurl_index !=0>
								<li style="float:left;list-style-type: none;line-height:180px;*font-size:157px;"><img rel="800:485" width="180" height="109.125" src="http://www.yueqiao.org${imgurl}"></li>
								</#if>
							</#list>
						</#if>
					</div>
						
					<a class="file_box" style="list-style-type: none;float: left;display: block; width:180px; height:180px; overflow: hidden; border: 1px solid #EBEBEB; background: none repeat scroll 0 0 #F3F3F3; color: #999999; cursor: pointer; text-align: center; margin-left:10px; ">
                    <em style="background:url(${staticServer}/img/add_newpic.png) 0 0; display: inline-block; width:180px; height:180px; overflow: hidden;line-height: 20em; vertical-align: middle;">
                    <input type="file" id="upload" style="display: block;width:180px; height:180px;opacity: 0; filter:alpha(opacity=0); "></em>
                    </a>
                    <label class="zt_widthlabel" style=" font-size:9px; float:left; visibility:hidden;">文件：</label>
                    <input type="text" id="all_words" style=" width:100px; height:10px; float:left;visibility:hidden;" class="input w180" value="<#if daikuan??>${daikuan.img_url}</#if>">
					</ul>
				</td>
			</tr>
			
		</table>
		<div id="controlbar">
			<input type="button" class="submit" onclick="addDaikuan()" value="  保  存  " />
		</div>
	</div>
	
</body>
</html>